<!DOCTYPE html>
<html>
<head>
<link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent-repeat" />
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Tests KeyboardEvent.repeat attribute");

var lastKeyboardEvent;

function recordKeyEvent(ev) {
    ev = ev || event;
    ev.keyCode = (ev.which || ev.keyCode);
    if (window.eventSender) {
        lastKeyboardEvent = ev;
    } else {
        debug("Type=" + ev.type + "," +
              "keyCode=" + ev.keyCode + ',' +
              "repeat=" + ev.repeat);
    }
}

var textarea = document.createElement("textarea");
textarea.addEventListener("keydown", recordKeyEvent, false);
document.body.insertBefore(textarea, document.body.firstChild);
textarea.focus();

if (window.eventSender) {
    eventSender.keyDown("a");
    shouldBeFalse("lastKeyboardEvent.repeat");

    eventSender.keyDown("a", ["autoRepeat"]);
    shouldBeTrue("lastKeyboardEvent.repeat");
}
</script>
</body>
</html>
